package com.ecfront.test.dao;

import java.util.Iterator;
import java.util.List;

import com.ecfront.dao.AdminDAO;
import com.ecfront.pojo.Admin;
import junit.framework.TestCase;

public class testAdminDao extends TestCase {
	private static final AdminDAO adminDao = (AdminDAO)SpringUtilTest.getBean("AdminDAO");
	//保存更新测试
	public void testSave(){
		Admin admin = new Admin();
		admin.setAdminName("admin");
		admin.setAdminPassword("admin888");
		admin.setPowerId(1);	
		adminDao.save(admin);
	}
	//删除测试
	public void testDel(){
		Admin admin = new Admin();
		admin.setAdminId(2);
		adminDao.delete(admin);
	}
	//FindAll测试
	public void testFindAll(){
		List list = adminDao.findAll();
		for(Iterator iter = list.iterator();iter.hasNext();){
			Admin admin = (Admin)iter.next();
			System.out.println(admin.getAdminName());
			System.out.println(admin.getAdminPassword());
		}
	}
	//FindByName测试
	public void testFindByName(){
		List list = adminDao.findByAdminName("admin888");
		for(Iterator iter = list.iterator();iter.hasNext();){
			Admin admin = (Admin)iter.next();
			System.out.println(admin.getAdminName());
			System.out.println(admin.getAdminPassword());
		}
	}
}
